home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 13682 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.7 KB

  1. Path: news.sprintlink.net!datalytics!usenet
  2. From: Rob Stewart <stew@datalytics.com>
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Protected functions
  5. Date: Tue, 26 Mar 1996 17:12:07 -0500
  6. Organization: Datalytics, Inc
  7. Message-ID: <31586BB7.347A@datalytics.com>
  8. References: <3155636F.3461@clubi.ie> <4j63qe$eq7@news1.h1.usa.pipeline.com>
  9. NNTP-Posting-Host: 204.62.224.71
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 2.0 (WinNT; I)
  14.  
  15. Pete Grant wrote:
  16. > On Mar 24, 1996 14:59:59 in article <Protected functions>, 'BRUCE
  17. > <jbruce@clubi.ie>' wrote:
  18. > >Can any one tell  me what a protected function of a class is ?
  19. > >
  20. > A protected member function is just like any other member function
  21. > except that it may be called only by:
  22. >   1.  member functions of the class.
  23. >   2.  member functions of non-privately derived classes.
  24.  
  25. Close, but no cigar.  According to ARM 11.2, "If a class is 
  26. declared to be a base class for another class using the private 
  27. access specifier, the public and protected members of the base 
  28. class are private members of the derived class."  In other 
  29. words, the public and protected members of the base class are 
  30. accessible to the derived class even with private inheritance.  
  31. Private inheritance only serves to prevent further derived 
  32. classes from seeing that private base class and its members.
  33.  
  34. >   3.  friends of the class.
  35. > There's a little more detail, but the above is a good starting
  36. > point.  BTW, need I say that #2 is only for classes derived
  37. > from the class which has the protected member in question?
  38.  
  39. -- 
  40. Robert Stewart        | My opinions are usually my own.
  41. Datalytics, Inc.    | stew@datalytics.com
  42.